package com.heima.wemedia.feign;

import com.heima.apis.wemedia.IWeMediaClient;
import com.heima.model.admin.pojos.ApUserRealname;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.pojos.ApUser;
import com.heima.wemedia.service.WmChannelService;
import com.heima.wemedia.service.WmSensitiveService;
import com.heima.wemedia.service.WmUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class WeMediaClient implements IWeMediaClient {

    @Autowired
    private WmChannelService wmChannelService;
    @Autowired
    private WmUserService wmUserService;
    @Autowired
    private WmSensitiveService wmSensitiveService;

    /**
     * 同步自媒体端用户账号密码
     */
    @Override
    @PostMapping("/api/v1/wemedia/author")
    public ResponseResult saveAuthor(ApUser author) {
        return wmUserService.saveAuthor(author);
    }

    /**
     * 获取频道列表
     *
     * @return
     */
    @Override
    @GetMapping("/api/v1/channel/list")
    public ResponseResult getChannels() {
        return wmChannelService.findAll();
    }

    @Override
    @PostMapping("/api/v1/Sensitive/handleSensitive")
    public Map<String, Object> handleSensitiveScan(String content) {
        return wmSensitiveService.handleSensitiveScan(content);
    }
}
